package wx

import (
	"encoding/xml"
	"fmt"
	"github.com/gin-gonic/gin"
)

func msgReceive(c *gin.Context) {
	var msg TextMsg
	err := c.ShouldBindXML(&msg)
	if err != nil {
		fmt.Println("[消息接收]", "Xml数据包解析失败")
		return
	}
	fmt.Println("[消息接收]", "消息类型%s", "消息内容：%", msg.MsgType, msg.Content)
	msgReply(c, msg.ToUserName, msg.FOrmUserName)
}

func msgReply(c *gin.Context, fromUsr string, toUser string) {
	/*msg := TextMsg{
		ToUserName:   toUser,
		FOrmUserName: fromUsr,
		CreateTime:   time.Now().Unix(),
	}*/
}

type TextMsg struct {
	ToUserName   string
	FOrmUserName string
	CreateTime   int64
	MsgType      string
	Content      string
	XMLName      xml.Name
}
